package io;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

public class CopyDemo {
    public static void main(String[] args) throws IOException {
        FileInputStream fis = new FileInputStream("./image.jpg");
        FileOutputStream fos = new FileOutputStream("./image_cp.jpg");
        //FileOutputStream fos2 = new FileOutputStream("./image_cp1.jpg");
        int d;
//        while ((d = fis.read()) != -1) {
//            fos.write(d);
//        }
//        System.out.println("复制完毕");
        d = fis.read();
        System.out.println(d);
        fis.close();
        fos.close();
//        int len;
//        byte[] date = new byte[5];
//        long start =  System.currentTimeMillis();
//        while ((len = fis.read(date)) != -1) {
//            //fos2.write(date);
//            fos2.write(date,0,len);
//        }
//        long end = System.currentTimeMillis();
//        System.out.println("复制完毕，用时"+ (end-start));
//       fis.close();
//       fos2.close();
    }
}
